<% form_tag(:controller=>"entities", :action=>"add_to_group") do %>
  <h3> <%= clique.name %> </h3>
  <% members = clique.puddleMembers %>
  
  <div class="hiddenfield">
  <%= hidden_field_tag(:clique_id, clique.id) %>
  </div>

  <% members.each do |member| %>
    <li>
    <%= link_to member.name, show_friend_path(member.id) %> is part of this group.
    <%= link_to("Remove " + member.name, remove_from_group_path(clique.id, member.id)) %> from this group. 
    </li>
  <% end %>
  <% @possible_friends = [] %>

  <% User.find(session[:user_id]).find_permissible_friends.each do |f| %>
    <% unless members.include?(f) %>
      <% @possible_friends << f %>
    <% end %>
  <% end %>

  <% if @possible_friends.count > 0 %>
  <div class="field">
    <%= label_tag(:add_member, "Add a member to " + clique.name) %>
    <%= collection_select(nil, :member_id, @possible_friends, :id, :name, {}, {:title=>'Choose a friend to add to ' + clique.name}) %>
    <%= submit_tag "Add friend to group", :title=>"Add friend to group" %>    
  <% end %>
    
  </div>
<% end %>
